package com.superhelper.common.domain;

public enum TakeOutOrderStatus {
    PENDING("未生效", "pending"), UNPROCESSED("未处理", "unprocessed"), REFUNDING("退单处理中", "refunding"), VALID("商家已处理",
            "valid"), DELIVERING("配送中", "delivering"), INVALID("无效", "invalid"), SETTLED("已完成",
                    "settled"), APPLY_CANCEL("用户申请退款", "apply_cancel"), REVOKE_REFUND("用户取消退款",
                            "revoke_refund"), REJECT_CANCEL("拒绝取消", "reject_cancel");
    private String name;
    private String value;

    private TakeOutOrderStatus(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public String getValue() {
        return value;
    }

    // 1 用户已提交订单
    // 2 可推送到App方平台也可推送到商家
    // 3 商家已收到
    // 4 商家已确认
    // 6 已配送
    // 8 已完成
    // 9 已取消
    public static TakeOutOrderStatus getByMtStatus(int status) {
        switch (status) {
        case 1:
            return PENDING;
        case 2:
            return UNPROCESSED;
        case 3:
        case 4:
            return VALID;
        case 6:
            return DELIVERING;
        case 8:
            return SETTLED;
        case 9:
            return INVALID;
        }
        return INVALID;
    }

    public static TakeOutOrderStatus getByBdStatus(Integer status) {
        switch (status) {
        case 1:
            return UNPROCESSED;
        case 5:
            return VALID;
        case 7:
        case 8:
            return DELIVERING;
        case 9:
            return SETTLED;
        case 10:
            return INVALID;
        }
        return INVALID;
    }

}
